package com.zs.games.exception;

import com.zs.games.resultTool.ResultCodeEnum;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;

/**
 * 自定义异常
 */
@Getter
@ToString
@EqualsAndHashCode(callSuper=true)
public class APIException extends RuntimeException {
    private long code;
    private String msg;


    public APIException() {
        this(1001L, "接口错误");
    }

    public APIException(String msg) {
        this(1001L, msg);
    }

    public APIException(long code, String msg) {
        super(msg);
        this.code = code;
        this.msg = msg;
    }

    public APIException(ResultCodeEnum resultCodeEnum){
        this(resultCodeEnum.getCode(),resultCodeEnum.getMessage());
    }
}
